<template>
  <!-- 列表区域 -->
  <section class="main">
    <ul class="todo-list">
      <li v-for="(item, index) in list" :key="index" class="todo">
        <div class="view">
          <span class="index"> {{ index + 1 }} </span>
          <label>{{ item.name }}</label>
          <button @click="del(item.id)" class="destroy"></button>
        </div>
      </li>
    </ul>
  </section>
</template>

<script>
export default {
  props: {
    list: Array,
  },
  methods: {
    del(id) {
      // console.log(id);
      this.$emit("idhander", id);
    },
  },
};
</script>

<style></style>
